﻿using CheccCoverplateCulvertAssemble.Common;
using CheccCoverplateCulvertAssemble.Entity;
using CheccCoverplateCulvertAssemble.FormColl;
using CheccCoverplateCulvertAssemble.Tools;
using CheccTexturePropertyGive;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static Bentley.CIMNET.CIMGeometry.Solid.SolidUtil.Modify;
using static CheccTexturePropertyGive.SetCoverCulvertTexture;

namespace CheccCoverplateCulvertAssemble.Operation.dynamic
{
    public class DynamicCreateEntity
    {
        BasicConstructor basicConstructor = null;
        DMatrix3d dMatrix3D;
        DPoint3d placeDpoint3d;
        bool isBracingBeam = false;
        public DynamicCreateEntity(BasicConstructor basic,DMatrix3d dMatrix3D,DPoint3d placeDpoint3d,  bool isBracingBeam) 
        {
            this.basicConstructor = basic;   
            this.dMatrix3D = dMatrix3D;  //放置矩阵
            this.placeDpoint3d = placeDpoint3d;  //放置点
            this.isBracingBeam = isBracingBeam;     //是否有支撑梁
        }    
        public List<Element> CreateUnitaryBasicModel()
        {
            var objParameter = GetBasicParameter();
            DPoint3d[] points =
            {
            new DPoint3d(0,(objParameter.clearSpan / 2 + objParameter.standPly),0)* GeneralBank.UorToMeters,
            new DPoint3d(0,(objParameter.clearSpan / 2 + objParameter.standPly) ,-(objParameter.piecePly + objParameter.clearHeight)) * GeneralBank.UorToMeters,
            new DPoint3d(0,(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge),-(objParameter.piecePly + objParameter.clearHeight))* GeneralBank.UorToMeters,
            new DPoint3d(0,(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge),-(objParameter.piecePly + objParameter.clearHeight + objParameter.basicsPly)) * GeneralBank.UorToMeters,
            new DPoint3d(0,-(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge),-(objParameter.piecePly + objParameter.clearHeight + objParameter.basicsPly)) * GeneralBank.UorToMeters,
            new DPoint3d(0,-(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge),-(objParameter.piecePly + objParameter.clearHeight)) * GeneralBank.UorToMeters,
            new DPoint3d(0,-(objParameter.clearSpan / 2 + objParameter.standPly),-(objParameter.piecePly + objParameter.clearHeight)) * GeneralBank.UorToMeters,
            new DPoint3d(0,-(objParameter.clearSpan / 2 + objParameter.standPly),0) * GeneralBank.UorToMeters,

            new DPoint3d(0,-(objParameter.clearSpan / 2 + objParameter.standPly - objParameter.standTopWidth),0) * GeneralBank.UorToMeters,
            new DPoint3d(0, -(objParameter.clearSpan / 2 + objParameter.standPly - objParameter.standTopWidth),-objParameter.piecePly) * GeneralBank.UorToMeters,
            new DPoint3d(0, -(objParameter.clearSpan / 2) ,-objParameter.piecePly)* GeneralBank.UorToMeters,
            new DPoint3d(0, -(objParameter.clearSpan / 2),-(objParameter.piecePly + objParameter.clearHeight - objParameter.bottomChamfer))* GeneralBank.UorToMeters,
            new DPoint3d(0, -(objParameter.clearSpan / 2 - objParameter.bottomChamfer),-(objParameter.piecePly + objParameter.clearHeight)) * GeneralBank.UorToMeters,
            new DPoint3d(0, (objParameter.clearSpan / 2 - objParameter.bottomChamfer),-(objParameter.piecePly + objParameter.clearHeight)) * GeneralBank.UorToMeters,
            new DPoint3d(0,objParameter.clearSpan / 2,-(objParameter.piecePly + objParameter.clearHeight - objParameter.bottomChamfer)) * GeneralBank.UorToMeters,
            new DPoint3d(0, objParameter.clearSpan / 2 ,-objParameter.piecePly) * GeneralBank.UorToMeters,
            new DPoint3d(0, (objParameter.clearSpan / 2 + objParameter.standPly - objParameter.standTopWidth),-objParameter.piecePly )* GeneralBank.UorToMeters,
            new DPoint3d(0, (objParameter.clearSpan / 2 + objParameter.standPly - objParameter.standTopWidth),0) * GeneralBank.UorToMeters,
            new DPoint3d(0,(objParameter.clearSpan / 2 + objParameter.standPly),0) * GeneralBank.UorToMeters,
            };
            ShapeElement shapeElement = new ShapeElement(GeneralBank.Default3DModel, null, points);
            //盖板
            DPoint3d[] slabPoints =
            {
            new DPoint3d(0,(objParameter.clearSpan / 2 + objParameter.standPly - objParameter.standTopWidth),0)* GeneralBank.UorToMeters,
            new DPoint3d(0,-(objParameter.clearSpan / 2 + objParameter.standPly - objParameter.standTopWidth) ,0) * GeneralBank.UorToMeters,
            new DPoint3d(0,-(objParameter.clearSpan / 2 + objParameter.standPly - objParameter.standTopWidth) ,-objParameter.piecePly) * GeneralBank.UorToMeters,
            new DPoint3d(0,(objParameter.clearSpan / 2 + objParameter.standPly - objParameter.standTopWidth),-objParameter.piecePly)* GeneralBank.UorToMeters,
            new DPoint3d(0,(objParameter.clearSpan / 2 + objParameter.standPly - objParameter.standTopWidth),0)* GeneralBank.UorToMeters
            };
            ShapeElement shapeElementSlab = new ShapeElement(GeneralBank.Default3DModel, null, slabPoints);

            CurveVector secCur = shapeElement.GetCurveVector();
            double jj = Math.Tan((90 - objParameter.leftLateralAngle) * Math.PI / 180);
            double LeftLateralOffset = Math.Abs((objParameter.standPly * 2 + objParameter.clearSpan + objParameter.basicsEdge * 2) * Math.Tan((90 - objParameter.leftLateralAngle) * Math.PI / 180));
            double RightLateralOffset = Math.Abs((objParameter.standPly * 2 + objParameter.clearSpan + objParameter.basicsEdge * 2) * Math.Tan((90 - objParameter.rightLateralAngle) * Math.PI / 180));
            LineElement lineElement = GetSlopLinee(DPoint3d.Zero, objParameter.basicsLength + LeftLateralOffset / 2 + RightLateralOffset / 2, objParameter.baseSlope, out DPoint3d slopeEndPT);
            CurveVector linePath = lineElement.GetCurveVector();
            SolidKernelEntity solidKernel = CreateBodyFromSweep(linePath, secCur, GeneralBank.Default3DModel);
            SolidKernelEntity solidKernelSlab = CreateBodyFromSweep(linePath, shapeElementSlab.GetCurveVector(), GeneralBank.Default3DModel);
            double z = LeftLateralOffset / 2 * objParameter.baseSlope;
            DPoint3d movePoint3d = new DPoint3d(-LeftLateralOffset / 2, 0, -z) * GeneralBank.UorToMeters;
            DTransform3d trans = DTransform3d.Identity;
            trans.Translation = movePoint3d;
            TransformBody(ref solidKernel, trans);
            TransformBody(ref solidKernelSlab, trans);
            if (objParameter.leftLateralAngle != 90)
            {
                LineElement cutLine = null;
                CurveVector cutLinePath = null;
                if (objParameter.leftLateralAngle < 90)
                {
                    cutLine = new LineElement(GeneralBank.Default3DModel, null, new DSegment3d(
                        new DPoint3d(-LeftLateralOffset / 2, -(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters,
                        new DPoint3d(LeftLateralOffset / 2, (objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters));
                }
                else if (objParameter.leftLateralAngle > 90)
                {
                    cutLine = new LineElement(GeneralBank.Default3DModel, null, new DSegment3d(
                        new DPoint3d(LeftLateralOffset / 2, -(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters,
                        new DPoint3d(-LeftLateralOffset / 2, (objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters));
                }
                cutLinePath = cutLine.GetCurveVector();
                Bentley.CIMNET.CIMGeometry.Solid.SolidUtil.Modify.CutSolidsWithCurves(out SolidKernelEntity[] solidKernels, solidKernel, cutLinePath, SolidCutMethod.Split, SolidCutDirection.Both, SolidCutMode.Through, 0);
                if(solidKernels != null) solidKernel = solidKernels[0];
                Bentley.CIMNET.CIMGeometry.Solid.SolidUtil.Modify.CutSolidsWithCurves(out SolidKernelEntity[] solidKernelsSlab, solidKernelSlab, cutLinePath, SolidCutMethod.Split, SolidCutDirection.Both, SolidCutMode.Through, 0);
                if(solidKernelsSlab != null) solidKernelSlab = solidKernelsSlab[0];
            }

            if (objParameter.rightLateralAngle != 90)
            {
                LineElement cutLine = null;
                CurveVector cutLinePath = null;
                //涵长
                double overallLength = objParameter.basicsLength;

                if (objParameter.rightLateralAngle < 90)
                {
                    cutLine = new LineElement(GeneralBank.Default3DModel, null, new DSegment3d(
                            new DPoint3d(overallLength + RightLateralOffset / 2, (objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters,
                            new DPoint3d(overallLength - RightLateralOffset / 2, -(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters));
                }
                else if (objParameter.rightLateralAngle > 90)
                {
                    cutLine = new LineElement(GeneralBank.Default3DModel, null, new DSegment3d(
                            new DPoint3d(overallLength - RightLateralOffset / 2, (objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters,
                            new DPoint3d(overallLength + RightLateralOffset / 2, -(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters));
                }
                cutLinePath = cutLine.GetCurveVector();
                Bentley.CIMNET.CIMGeometry.Solid.SolidUtil.Modify.CutSolidsWithCurves(out SolidKernelEntity[] solidKernels, solidKernel, cutLinePath, SolidCutMethod.Split, SolidCutDirection.Both, SolidCutMode.Through, 0);
                if(solidKernels != null) solidKernel = solidKernels[0];
                Bentley.CIMNET.CIMGeometry.Solid.SolidUtil.Modify.CutSolidsWithCurves(out SolidKernelEntity[] solidKernelsSlab, solidKernelSlab, cutLinePath, SolidCutMethod.Split, SolidCutDirection.Both, SolidCutMode.Through, 0);
                if (solidKernelsSlab != null) solidKernelSlab = solidKernelsSlab[0];
            }
            if (solidKernel != null && solidKernelSlab != null)
            {
                Convert1.BodyToElement(out Element cutResultElement, solidKernel, null, GeneralBank.Default3DModel);
                Convert1.BodyToElement(out Element cutResultElementSlab, solidKernelSlab, null, GeneralBank.Default3DModel);
                //真实位置
                DTransform3d dTransform = new DTransform3d(this.dMatrix3D);
                dTransform.Translation = this.placeDpoint3d * GeneralBank.UorToMeters;
                TransformInfo dTransFormInfo = new TransformInfo(dTransform);
                cutResultElement.ApplyTransform(dTransFormInfo);
                cutResultElement.AddToModel();
                cutResultElementSlab.ApplyTransform(dTransFormInfo);
                cutResultElementSlab.AddToModel();
                return new List<Element> { cutResultElement, cutResultElementSlab };
            }
            else
            {
                return null;
            }

        }

        public List<Element> CreateSeparatingBasicModel()
        {
            List<Element> listElement = new List<Element>();
            listElement.AddRange(CreateBermLeft());
            listElement.Add(CreateBermRight());
            listElement.Add(CreateBasicsLeft());
            listElement.Add(CreateBasicsRight());
            listElement.AddRange(CreateEntityModelBracings());
            return listElement;
        }

        private List<Element> CreateBermLeft()
        {
            var objParameter = GetBasicParameter();
            DPoint3d[] points =
            {
                new DPoint3d(0,(objParameter.clearSpan / 2 + objParameter.standPly)* GeneralBank.UorToMeters ,0),
                new DPoint3d(0,(objParameter.clearSpan / 2 + objParameter.standPly)* GeneralBank.UorToMeters,-(objParameter.piecePly + objParameter.clearHeight) * GeneralBank.UorToMeters),
                new DPoint3d(0,objParameter.clearSpan / 2 * GeneralBank.UorToMeters,-(objParameter.piecePly + objParameter.clearHeight) * GeneralBank.UorToMeters),
                new DPoint3d(0,objParameter.clearSpan / 2 * GeneralBank.UorToMeters,-(objParameter.piecePly) * GeneralBank.UorToMeters),
                new DPoint3d(0,(objParameter.clearSpan / 2 + objParameter.standPly -objParameter.standTopWidth ) * GeneralBank.UorToMeters,-(objParameter.piecePly) * GeneralBank.UorToMeters),
                new DPoint3d(0,(objParameter.clearSpan / 2 + objParameter.standPly -objParameter.standTopWidth ) * GeneralBank.UorToMeters,0),
                new DPoint3d(0,(objParameter.clearSpan / 2 + objParameter.standPly)* GeneralBank.UorToMeters ,0),
            };

            ShapeElement shapeElement = new ShapeElement(GeneralBank.Default3DModel, null, points);

            //盖板
            DPoint3d[] slabPoints =
            {
            new DPoint3d(0,(objParameter.clearSpan / 2 + objParameter.standPly - objParameter.standTopWidth),0)* GeneralBank.UorToMeters,
            new DPoint3d(0,-(objParameter.clearSpan / 2 + objParameter.standPly - objParameter.standTopWidth) ,0) * GeneralBank.UorToMeters,
            new DPoint3d(0,-(objParameter.clearSpan / 2 + objParameter.standPly - objParameter.standTopWidth) ,-objParameter.piecePly) * GeneralBank.UorToMeters,
            new DPoint3d(0,(objParameter.clearSpan / 2 + objParameter.standPly - objParameter.standTopWidth),-objParameter.piecePly)* GeneralBank.UorToMeters,
            new DPoint3d(0,(objParameter.clearSpan / 2 + objParameter.standPly - objParameter.standTopWidth),0)* GeneralBank.UorToMeters
            };
            ShapeElement shapeElementSlab = new ShapeElement(GeneralBank.Default3DModel, null, slabPoints);

            CurveVector secCur = shapeElement.GetCurveVector();
            double LeftLateralOffset = Math.Abs((objParameter.standPly * 2 + objParameter.clearSpan + objParameter.basicsEdge * 2) * Math.Tan((90 - objParameter.leftLateralAngle) * Math.PI / 180));
            double RightLateralOffset = Math.Abs((objParameter.standPly * 2 + objParameter.clearSpan + objParameter.basicsEdge * 2) * Math.Tan((90 - objParameter.rightLateralAngle) * Math.PI / 180));

            LineElement lineElement = GetSlopLinee(DPoint3d.Zero, objParameter.basicsLength + LeftLateralOffset / 2 + RightLateralOffset/2, objParameter.baseSlope, out DPoint3d slopeEndPT);
            CurveVector linePath = lineElement.GetCurveVector();
            SolidKernelEntity solidKernel = CreateBodyFromSweep(linePath, secCur, GeneralBank.Default3DModel);
            SolidKernelEntity solidKernelSlab = CreateBodyFromSweep(linePath, shapeElementSlab.GetCurveVector(), GeneralBank.Default3DModel);
            double z = LeftLateralOffset / 2 * objParameter.baseSlope;
            DPoint3d movePoint3d = new DPoint3d(-LeftLateralOffset / 2, 0, -z) * GeneralBank.UorToMeters;
            DTransform3d trans = DTransform3d.Identity;
            trans.Translation = movePoint3d;
            TransformBody(ref solidKernel, trans);
            TransformBody(ref solidKernelSlab, trans);

            LineElement cutLine = null;
            CurveVector cutLinePath = null;
            if (objParameter.leftLateralAngle != 90)
            {
                if (objParameter.leftLateralAngle < 90)
                {
                    cutLine = new LineElement(GeneralBank.Default3DModel, null, new DSegment3d(
                        new DPoint3d(-LeftLateralOffset / 2, -(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters,
                        new DPoint3d(LeftLateralOffset / 2, (objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters));
                }
                else if (objParameter.leftLateralAngle > 90)
                {
                    cutLine = new LineElement(GeneralBank.Default3DModel, null, new DSegment3d(
                        new DPoint3d(LeftLateralOffset / 2, -(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters,
                        new DPoint3d(-LeftLateralOffset / 2, (objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters));
                }
                cutLinePath = cutLine.GetCurveVector();
                Bentley.CIMNET.CIMGeometry.Solid.SolidUtil.Modify.CutSolidsWithCurves(out SolidKernelEntity[] solidKernels, solidKernel, cutLinePath, SolidCutMethod.Split, SolidCutDirection.Both, SolidCutMode.Through, 0);
                solidKernel = solidKernels[0];
                Bentley.CIMNET.CIMGeometry.Solid.SolidUtil.Modify.CutSolidsWithCurves(out SolidKernelEntity[] solidKernelsSlab, solidKernelSlab, cutLinePath, SolidCutMethod.Split, SolidCutDirection.Both, SolidCutMode.Through, 0);
                solidKernelSlab = solidKernelsSlab[0];
            }
            if (objParameter.rightLateralAngle != 90)
            {
                //总长
                double overallLength = objParameter.basicsLength;
                if (objParameter.rightLateralAngle < 90)
                {
                    cutLine = new LineElement(GeneralBank.Default3DModel, null, new DSegment3d(
                            new DPoint3d(overallLength + RightLateralOffset / 2, (objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters,
                            new DPoint3d(overallLength - RightLateralOffset / 2, -(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters));
                }
                else if (objParameter.rightLateralAngle > 90)
                {
                    cutLine = new LineElement(GeneralBank.Default3DModel, null, new DSegment3d(
                            new DPoint3d(overallLength - RightLateralOffset / 2, (objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters,
                            new DPoint3d(overallLength + RightLateralOffset / 2, -(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters));
                }
                cutLinePath = cutLine.GetCurveVector();
                Bentley.CIMNET.CIMGeometry.Solid.SolidUtil.Modify.CutSolidsWithCurves(out SolidKernelEntity[] solidKernels, solidKernel, cutLinePath, SolidCutMethod.Split, SolidCutDirection.Both, SolidCutMode.Through, 0);
                solidKernel = solidKernels[0];
                Bentley.CIMNET.CIMGeometry.Solid.SolidUtil.Modify.CutSolidsWithCurves(out SolidKernelEntity[] solidKernelsSlab, solidKernelSlab, cutLinePath, SolidCutMethod.Split, SolidCutDirection.Both, SolidCutMode.Through, 0);
                solidKernelSlab = solidKernelsSlab[0];
            }
            Convert1.BodyToElement(out Element cutResultElement, solidKernel, null, GeneralBank.Default3DModel);
            Convert1.BodyToElement(out Element cutResultElementSlab, solidKernelSlab, null, GeneralBank.Default3DModel);
            //真实位置
            DTransform3d dTransform = new DTransform3d(this.dMatrix3D);
            dTransform.Translation = this.placeDpoint3d * GeneralBank.UorToMeters;
            TransformInfo dTransFormInfo = new TransformInfo(dTransform);
            cutResultElement.ApplyTransform(dTransFormInfo);
            cutResultElement.AddToModel();
            cutResultElementSlab.ApplyTransform(dTransFormInfo);
            cutResultElementSlab.AddToModel();
            return new List<Element> { cutResultElement,cutResultElementSlab };
        }
        private Element CreateBermRight()
        {
            var objParameter = GetBasicParameter();
            DPoint3d[] points =
            {
                new DPoint3d(0,-(objParameter.clearSpan / 2 + objParameter.standPly)* GeneralBank.UorToMeters ,0),
                new DPoint3d(0,-(objParameter.clearSpan / 2 + objParameter.standPly)* GeneralBank.UorToMeters,-(objParameter.piecePly + objParameter.clearHeight) * GeneralBank.UorToMeters),
                new DPoint3d(0,-objParameter.clearSpan / 2 * GeneralBank.UorToMeters,-(objParameter.piecePly + objParameter.clearHeight) * GeneralBank.UorToMeters),
                new DPoint3d(0,-objParameter.clearSpan / 2 * GeneralBank.UorToMeters,-(objParameter.piecePly) * GeneralBank.UorToMeters),
                new DPoint3d(0,-(objParameter.clearSpan / 2 + objParameter.standPly -objParameter.standTopWidth ) * GeneralBank.UorToMeters,-(objParameter.piecePly) * GeneralBank.UorToMeters),
                new DPoint3d(0,-(objParameter.clearSpan / 2 + objParameter.standPly -objParameter.standTopWidth ) * GeneralBank.UorToMeters,0),
                new DPoint3d(0,-(objParameter.clearSpan / 2 + objParameter.standPly)* GeneralBank.UorToMeters ,0),
            };
            ShapeElement shapeElement = new ShapeElement(GeneralBank.Default3DModel, null, points);
            CurveVector secCur = shapeElement.GetCurveVector();
            double LeftLateralOffset = Math.Abs((objParameter.standPly * 2 + objParameter.clearSpan + objParameter.basicsEdge * 2) * Math.Tan((90 - objParameter.leftLateralAngle) * Math.PI / 180));
            double RightLateralOffset = Math.Abs((objParameter.standPly * 2 + objParameter.clearSpan + objParameter.basicsEdge * 2) * Math.Tan((90 - objParameter.rightLateralAngle) * Math.PI / 180));

            LineElement lineElement = GetSlopLinee(DPoint3d.Zero, objParameter.basicsLength + LeftLateralOffset / 2 + RightLateralOffset / 2, objParameter.baseSlope, out DPoint3d slopeEndPT);
            CurveVector linePath = lineElement.GetCurveVector();
            SolidKernelEntity solidKernel = CreateBodyFromSweep(linePath, secCur, GeneralBank.Default3DModel);

            double z = LeftLateralOffset / 2 * objParameter.baseSlope;
            DPoint3d movePoint3d = new DPoint3d(-LeftLateralOffset / 2, 0, -z) * GeneralBank.UorToMeters;
            DTransform3d trans = DTransform3d.Identity;
            trans.Translation = movePoint3d;
            TransformBody(ref solidKernel, trans);
            LineElement cutLine = null;
            CurveVector cutLinePath = null;
            if (objParameter.leftLateralAngle != 90)
            {
                if (objParameter.leftLateralAngle < 90)
                {
                    cutLine = new LineElement(GeneralBank.Default3DModel, null, new DSegment3d(
                        new DPoint3d(-LeftLateralOffset / 2, -(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters,
                        new DPoint3d(LeftLateralOffset / 2, (objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters));
                }
                else if (objParameter.leftLateralAngle > 90)
                {
                    cutLine = new LineElement(GeneralBank.Default3DModel, null, new DSegment3d(
                        new DPoint3d(LeftLateralOffset / 2, -(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters,
                        new DPoint3d(-LeftLateralOffset / 2, (objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters));
                }
                cutLinePath = cutLine.GetCurveVector();
                Bentley.CIMNET.CIMGeometry.Solid.SolidUtil.Modify.CutSolidsWithCurves(out SolidKernelEntity[] solidKernels, solidKernel, cutLinePath, SolidCutMethod.Split, SolidCutDirection.Both, SolidCutMode.Through, 0);
                solidKernel = solidKernels[0];
            }
            if (objParameter.rightLateralAngle != 90)
            {
                //总长
                double overallLength = objParameter.basicsLength;

                if (objParameter.rightLateralAngle < 90)
                {
                    cutLine = new LineElement(GeneralBank.Default3DModel, null, new DSegment3d(
                            new DPoint3d(overallLength + RightLateralOffset / 2, (objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters,
                            new DPoint3d(overallLength - RightLateralOffset / 2, -(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters));
                }
                else if (objParameter.rightLateralAngle > 90)
                {
                    cutLine = new LineElement(GeneralBank.Default3DModel, null, new DSegment3d(
                            new DPoint3d(overallLength - RightLateralOffset / 2, (objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters,
                            new DPoint3d(overallLength + RightLateralOffset / 2, -(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters));
                }
                cutLinePath = cutLine.GetCurveVector();
                Bentley.CIMNET.CIMGeometry.Solid.SolidUtil.Modify.CutSolidsWithCurves(out SolidKernelEntity[] solidKernels, solidKernel, cutLinePath, SolidCutMethod.Split, SolidCutDirection.Both, SolidCutMode.Through, 0);
                solidKernel = solidKernels[0];
            }
            Convert1.BodyToElement(out Element cutResultElement, solidKernel, null, GeneralBank.Default3DModel);

            //真实位置
            DTransform3d dTransform = new DTransform3d(this.dMatrix3D);
            dTransform.Translation = this.placeDpoint3d * GeneralBank.UorToMeters;
            TransformInfo dTransFormInfo = new TransformInfo(dTransform);
            cutResultElement.ApplyTransform(dTransFormInfo);
            cutResultElement.AddToModel();
            return  cutResultElement ;  
        }
        private Element CreateBasicsLeft()
        {
            var objParameter = GetBasicParameter();
            DPoint3d[] points =
            {
                new DPoint3d(0,(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge )* GeneralBank.UorToMeters,-(objParameter.piecePly + objParameter.clearHeight) * GeneralBank.UorToMeters),
                new DPoint3d(0,(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge )* GeneralBank.UorToMeters,-(objParameter.piecePly + objParameter.clearHeight + objParameter.basicsPly) * GeneralBank.UorToMeters),
                new DPoint3d(0,(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge - objParameter.basicsWidth )* GeneralBank.UorToMeters,-(objParameter.piecePly + objParameter.clearHeight + objParameter.basicsPly) * GeneralBank.UorToMeters),
                new DPoint3d(0,(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge - objParameter.basicsWidth )* GeneralBank.UorToMeters,-(objParameter.piecePly + objParameter.clearHeight) * GeneralBank.UorToMeters),
                new DPoint3d(0,(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge )* GeneralBank.UorToMeters,-(objParameter.piecePly + objParameter.clearHeight) * GeneralBank.UorToMeters)
            };

            ShapeElement shapeElement = new ShapeElement(GeneralBank.Default3DModel, null, points);
            CurveVector secCur = shapeElement.GetCurveVector();
            double LeftLateralOffset = Math.Abs((objParameter.standPly * 2 + objParameter.clearSpan + objParameter.basicsEdge * 2) * Math.Tan((90 - objParameter.leftLateralAngle) * Math.PI / 180));
            double RightLateralOffset = Math.Abs((objParameter.standPly * 2 + objParameter.clearSpan + objParameter.basicsEdge * 2) * Math.Tan((90 - objParameter.rightLateralAngle) * Math.PI / 180));

            LineElement lineElement = GetSlopLinee(DPoint3d.Zero, objParameter.basicsLength + LeftLateralOffset / 2 + RightLateralOffset / 2, objParameter.baseSlope, out DPoint3d slopeEndPT);
            CurveVector linePath = lineElement.GetCurveVector();
            SolidKernelEntity solidKernel = CreateBodyFromSweep(linePath, secCur, GeneralBank.Default3DModel);

            double z = LeftLateralOffset / 2 * objParameter.baseSlope;
            DPoint3d movePoint3d = new DPoint3d(-LeftLateralOffset / 2, 0, -z) * GeneralBank.UorToMeters;
            DTransform3d trans = DTransform3d.Identity;
            trans.Translation = movePoint3d;
            TransformBody(ref solidKernel, trans);
            LineElement cutLine = null;
            CurveVector cutLinePath = null;
            if (objParameter.leftLateralAngle != 90)
            {
                if (objParameter.leftLateralAngle < 90)
                {
                    cutLine = new LineElement(GeneralBank.Default3DModel, null, new DSegment3d(
                        new DPoint3d(-LeftLateralOffset / 2, -(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters,
                        new DPoint3d(LeftLateralOffset / 2, (objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters));
                }
                else if (objParameter.leftLateralAngle > 90)
                {
                    cutLine = new LineElement(GeneralBank.Default3DModel, null, new DSegment3d(
                        new DPoint3d(LeftLateralOffset / 2, -(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters,
                        new DPoint3d(-LeftLateralOffset / 2, (objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters));
                }
                cutLinePath = cutLine.GetCurveVector();
                Bentley.CIMNET.CIMGeometry.Solid.SolidUtil.Modify.CutSolidsWithCurves(out SolidKernelEntity[] solidKernels, solidKernel, cutLinePath, SolidCutMethod.Split, SolidCutDirection.Both, SolidCutMode.Through, 0);
                solidKernel = solidKernels[0];
            }
            if (objParameter.rightLateralAngle != 90)
            {
                //总长
                double overallLength =  objParameter.basicsLength;

                if (objParameter.rightLateralAngle < 90)
                {
                    cutLine = new LineElement(GeneralBank.Default3DModel, null, new DSegment3d(
                            new DPoint3d(overallLength + RightLateralOffset / 2, (objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters,
                            new DPoint3d(overallLength - RightLateralOffset / 2, -(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters));
                }
                else if (objParameter.rightLateralAngle > 90)
                {
                    cutLine = new LineElement(GeneralBank.Default3DModel, null, new DSegment3d(
                            new DPoint3d(overallLength - RightLateralOffset / 2, (objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters,
                            new DPoint3d(overallLength + RightLateralOffset / 2, -(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters));
                }
                cutLinePath = cutLine.GetCurveVector();
                Bentley.CIMNET.CIMGeometry.Solid.SolidUtil.Modify.CutSolidsWithCurves(out SolidKernelEntity[] solidKernels, solidKernel, cutLinePath, SolidCutMethod.Split, SolidCutDirection.Both, SolidCutMode.Through, 0);
                solidKernel = solidKernels[0];
            }
            Convert1.BodyToElement(out Element cutResultElement, solidKernel, null, GeneralBank.Default3DModel);

            //真实位置
            DTransform3d dTransform = new DTransform3d(this.dMatrix3D);
            dTransform.Translation = this.placeDpoint3d * GeneralBank.UorToMeters;
            TransformInfo dTransFormInfo = new TransformInfo(dTransform);
            cutResultElement.ApplyTransform(dTransFormInfo);
            cutResultElement.AddToModel();
            return cutResultElement;
        }
        private Element CreateBasicsRight()
        {
            var objParameter = GetBasicParameter();
            DPoint3d[] points =
            {
                new DPoint3d(0,-(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge )* GeneralBank.UorToMeters,-(objParameter.piecePly + objParameter.clearHeight) * GeneralBank.UorToMeters),
                new DPoint3d(0,-(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge )* GeneralBank.UorToMeters,-(objParameter.piecePly + objParameter.clearHeight + objParameter.basicsPly) * GeneralBank.UorToMeters),
                new DPoint3d(0,-(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge - objParameter.basicsWidth )* GeneralBank.UorToMeters,-(objParameter.piecePly + objParameter.clearHeight + objParameter.basicsPly) * GeneralBank.UorToMeters),
                new DPoint3d(0,-(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge - objParameter.basicsWidth )* GeneralBank.UorToMeters,-(objParameter.piecePly + objParameter.clearHeight) * GeneralBank.UorToMeters),
                new DPoint3d(0,-(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge )* GeneralBank.UorToMeters,-(objParameter.piecePly + objParameter.clearHeight) * GeneralBank.UorToMeters)
            };

            ShapeElement shapeElement = new ShapeElement(GeneralBank.Default3DModel, null, points);
            CurveVector secCur = shapeElement.GetCurveVector();

            double LeftLateralOffset = Math.Abs((objParameter.standPly * 2 + objParameter.clearSpan + objParameter.basicsEdge * 2) * Math.Tan((90 - objParameter.leftLateralAngle) * Math.PI / 180));
            double RightLateralOffset = Math.Abs((objParameter.standPly * 2 + objParameter.clearSpan + objParameter.basicsEdge * 2) * Math.Tan((90 - objParameter.rightLateralAngle) * Math.PI / 180));

            LineElement lineElement = GetSlopLinee(DPoint3d.Zero, objParameter.basicsLength + LeftLateralOffset / 2 + RightLateralOffset / 2, objParameter.baseSlope, out DPoint3d slopeEndPT);
            CurveVector linePath = lineElement.GetCurveVector();
            SolidKernelEntity solidKernel = CreateBodyFromSweep(linePath, secCur, GeneralBank.Default3DModel);

            double z = LeftLateralOffset / 2 * objParameter.baseSlope;
            DPoint3d movePoint3d = new DPoint3d(-LeftLateralOffset / 2, 0, -z) * GeneralBank.UorToMeters;
            DTransform3d trans = DTransform3d.Identity;
            trans.Translation = movePoint3d;
            TransformBody(ref solidKernel, trans);
            LineElement cutLine = null;
            CurveVector cutLinePath = null;

            if (objParameter.leftLateralAngle != 90)
            {
                if (objParameter.leftLateralAngle < 90)
                {
                    cutLine = new LineElement(GeneralBank.Default3DModel, null, new DSegment3d(
                        new DPoint3d(-LeftLateralOffset / 2, -(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters,
                        new DPoint3d(LeftLateralOffset / 2, (objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters));
                }
                else if (objParameter.leftLateralAngle > 90)
                {
                    cutLine = new LineElement(GeneralBank.Default3DModel, null, new DSegment3d(
                        new DPoint3d(LeftLateralOffset / 2, -(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters,
                        new DPoint3d(-LeftLateralOffset / 2, (objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters));
                }
                cutLinePath = cutLine.GetCurveVector();
                Bentley.CIMNET.CIMGeometry.Solid.SolidUtil.Modify.CutSolidsWithCurves(out SolidKernelEntity[] solidKernels, solidKernel, cutLinePath, SolidCutMethod.Split, SolidCutDirection.Both, SolidCutMode.Through, 0);
                solidKernel = solidKernels[0];
            }
            if (objParameter.rightLateralAngle != 90)
            {
                //总长
                double overallLength =  objParameter.basicsLength;

                if (objParameter.rightLateralAngle < 90)
                {
                    cutLine = new LineElement(GeneralBank.Default3DModel, null, new DSegment3d(
                            new DPoint3d(overallLength + RightLateralOffset / 2, (objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters,
                            new DPoint3d(overallLength - RightLateralOffset / 2, -(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters));
                }
                else if (objParameter.rightLateralAngle > 90)
                {
                    cutLine = new LineElement(GeneralBank.Default3DModel, null, new DSegment3d(
                            new DPoint3d(overallLength - RightLateralOffset / 2, (objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters,
                            new DPoint3d(overallLength + RightLateralOffset / 2, -(objParameter.clearSpan / 2 + objParameter.standPly + objParameter.basicsEdge), 0) * GeneralBank.UorToMeters));
                }
                cutLinePath = cutLine.GetCurveVector();
                Bentley.CIMNET.CIMGeometry.Solid.SolidUtil.Modify.CutSolidsWithCurves(out SolidKernelEntity[] solidKernels, solidKernel, cutLinePath, SolidCutMethod.Split, SolidCutDirection.Both, SolidCutMode.Through, 0);
                solidKernel = solidKernels[0];
            }
            Convert1.BodyToElement(out Element cutResultElement, solidKernel, null, GeneralBank.Default3DModel);

            //真实位置
            DTransform3d dTransform = new DTransform3d(this.dMatrix3D);
            dTransform.Translation = this.placeDpoint3d * GeneralBank.UorToMeters;
            TransformInfo dTransFormInfo = new TransformInfo(dTransform);
            cutResultElement.ApplyTransform(dTransFormInfo);
            cutResultElement.AddToModel();
            return cutResultElement;    
        }


        public  List<Element> CreateEntityModelBracings()
        {
            List<Element> elements = new List<Element>();
            var objParameter = GetBasicParameter();
            var bracingBramParameter = GetBracingBeamParameter();

            if (this.isBracingBeam)
            {
                //涵身左右两侧偏移长度
                double LeftLateralOffset = Math.Abs((objParameter.standPly + objParameter.clearSpan / 2 + objParameter.basicsEdge) * Math.Tan((90 - objParameter.leftLateralAngle) * Math.PI / 180));
                double RightLateralOffset = Math.Abs((objParameter.standPly + objParameter.clearSpan / 2 + objParameter.basicsEdge) * Math.Tan((90 - objParameter.rightLateralAngle) * Math.PI / 180));
                double staZ = objParameter.piecePly + objParameter.clearHeight;
                double a = Math.Atan(objParameter.baseSlope) * 180 / Math.PI;
                Angle angle = Angle.FromDegrees(Math.Atan(objParameter.baseSlope) * 180 / Math.PI);
                for (int i = 0; i < 2; i++)
                {
                    double staX = i == 0 ? LeftLateralOffset + bracingBramParameter.bracingBeamWidth / 2 : objParameter.basicsLength - RightLateralOffset - bracingBramParameter.bracingBeamWidth / 2;
                    double offsetZ = staX * objParameter.baseSlope;
                    DPoint3d movePoint3d = new DPoint3d(staX, 0, -staZ + offsetZ) * GeneralBank.UorToMeters;
                    DTransform3d trans = DTransform3d.FromRotationAroundLine(DPoint3d.Zero, new DVector3d(0, 1, 0), -angle);
                    trans.Translation = movePoint3d;
                    elements.Add(CraeteBracings(trans));
                }
            }
            return elements;    
        }

        public Element CraeteBracings(DTransform3d dTransform)
        {
            var bracingBramParameter = GetBracingBeamParameter();
            DPoint3d[] points =
            {
                new DPoint3d(-bracingBramParameter.bracingBeamWidth/2,0,0) * GeneralBank.UorToMeters,
                new DPoint3d(bracingBramParameter.bracingBeamWidth/2,0,0) * GeneralBank.UorToMeters,
                new DPoint3d(bracingBramParameter.bracingBeamWidth/2,0,bracingBramParameter.bracingBeamHeight) * GeneralBank.UorToMeters,
                new DPoint3d(-bracingBramParameter.bracingBeamWidth/2,0,bracingBramParameter.bracingBeamHeight) * GeneralBank.UorToMeters,
                new DPoint3d(-bracingBramParameter.bracingBeamWidth/2,0,0) * GeneralBank.UorToMeters,
            };

            ShapeElement shapeElement = new ShapeElement(GeneralBank.Default3DModel, null, points);
            CurveVector secCur = shapeElement.GetCurveVector();
            LineElement lineElement = new LineElement(GeneralBank.Default3DModel, null,
                new DSegment3d(DPoint3d.Zero, new DPoint3d(0, bracingBramParameter.racingBeamLength, 0) * GeneralBank.UorToMeters));
            CurveVector linePath = lineElement.GetCurveVector();
            SolidKernelEntity solidKernel = CreateBodyFromSweep(linePath, secCur, GeneralBank.Default3DModel);

            DPoint3d movePoint3d = new DPoint3d(0, -bracingBramParameter.racingBeamLength / 2, 0) * GeneralBank.UorToMeters;
            DTransform3d trans = DTransform3d.Identity;
            trans.Translation = movePoint3d;
            TransformBody(ref solidKernel, trans);
            Convert1.BodyToElement(out Element resultElement, solidKernel, null, GeneralBank.Default3DModel);

            TransformInfo transformInfo = new TransformInfo(dTransform);
            resultElement.ApplyTransform(transformInfo);

            //真实位置
            DTransform3d dTransform3d = new DTransform3d(this.dMatrix3D);
            dTransform3d.Translation = this.placeDpoint3d * GeneralBank.UorToMeters;
            TransformInfo dTransFormInfo = new TransformInfo(dTransform3d);
            resultElement.ApplyTransform(dTransFormInfo);
            resultElement.AddToModel();
            return resultElement;
        }


        /// <summary>
        /// 基于dPoint3D点沿X轴绘制线
        /// </summary>
        /// <param name="boxCulvertLength">涵长水平距离</param>
        /// <param name="slop">坡度; (例如0.1就是10%的坡率)</param>
        /// <returns></returns>
        public LineElement GetSlopLinee(DPoint3d dPoint3D, double boxCulvertLength, double slop, out DPoint3d endPt)
        {
            double z = boxCulvertLength * slop;
            endPt = new DPoint3d(dPoint3D.X + boxCulvertLength, dPoint3D.Y, dPoint3D.Z + z) * GeneralBank.UorToMeters;
            return new LineElement(GeneralBank.Default3DModel, null, new DSegment3d(dPoint3D * GeneralBank.UorToMeters, new DPoint3d(dPoint3D.X + boxCulvertLength, dPoint3D.Y, dPoint3D.Z + z) * GeneralBank.UorToMeters));
        }

        public SolidKernelEntity CreateBodyFromSweep(CurveVector pathCur, CurveVector secCur, DgnModel modelRef)
        {
            pathCur.GetStartEnd(out DPoint3d startPt, out _, out DVector3d startTangent, out _);
            CurveVector secCur1 = secCur.Clone();
            BCIMNETGS.SolidUtil.Create.BodyFromSweep(out SolidKernelEntity entity, secCur1, pathCur, modelRef, false, true, false, null, null, null, null);
            return entity;
        }

        /// <summary>
        /// 获取洞身构造参数
        /// </summary>
        /// <returns> 涵长,左偏角,右偏角,涵身沉降缝宽度,基础沉降缝宽度,涵底坡度, 净跨,净高,挡块高度,基础襟边,台身厚度,台身顶宽,基础宽度,底部倒角,基础厚度,净保护层</returns>
        /// 
        private (double basicsLength, double leftLateralAngle, double rightLateralAngle, double culvertGapWidth, double baseGapWidth, double baseSlope, double clearSpan, double clearHeight,
            double piecePly, double basicsEdge, double standPly, double standTopWidth,double basicsWidth, double bottomChamfer, double basicsPly, double protectiveLayer) GetBasicParameter()
        {
            double basicsLength = this.basicConstructor.BasicsLength;
            double leftLateralAngle = this.basicConstructor.LeftLateralAngle;
            double rightLateralAngle = this.basicConstructor.RightLateralAngle;
            double culvertGapWidth = this.basicConstructor.CulvertGapWidth / 100;
            double baseGapWidth = this.basicConstructor.BaseGapWidth / 100;
            double baseSlope = this.basicConstructor.CulvertBaseSlope / 100;
            double clearSpan = this.basicConstructor.ClearSpan;
            double clearHeight = this.basicConstructor.ClearHeight;
            double piecePly = this.basicConstructor.PiecePly / 100;
            double basicsEdge = this.basicConstructor.BasicsEdge / 100;
            double standPly = this.basicConstructor.StandPly / 100;
            double standTopWidth = this.basicConstructor.StandTopWidth / 100;
            double basicsWidth = this.basicConstructor.BasicWidth / 100;
            double bottomChamfer = this.basicConstructor.BottomChamfer / 100;
            double basicsPly = this.basicConstructor.BasicsPly / 100;
            double protectiveLayer = this.basicConstructor.ProtectiveLayer;
            return (basicsLength, leftLateralAngle, rightLateralAngle, culvertGapWidth, baseGapWidth, baseSlope, clearSpan, clearHeight, piecePly, basicsEdge, standPly, standTopWidth, basicsWidth, bottomChamfer, basicsPly, protectiveLayer);
        }

        /// <summary>
        /// 获取支撑梁构造参数
        /// </summary>
        /// <returns>涵长分段, 长度，高度，宽度，主筋边距</returns>
        private (List<double> culvertLenLists, double racingBeamLength, double bracingBeamHeight, double bracingBeamWidth, double bracingBeamInterva) GetBracingBeamParameter()
        {
            List<double> culvertLenLists = this.basicConstructor.CulvertLenLists;
            double racingBeamLength = this.basicConstructor.BracingBeamLength / 100;
            double bracingBeamHeight = this.basicConstructor.BracingBeamHeight / 100;
            double bracingBeamWidth = this.basicConstructor.BracingBeamWidth / 100;
            double bracingBeamInterva = this.basicConstructor.BracingBeamInterval / 100;
            return (culvertLenLists, racingBeamLength, bracingBeamHeight, bracingBeamWidth, bracingBeamInterva);
        }
    }
}
